package com.xx.secret.enums;

import lombok.Getter;

/**
 * @author wangcheng
 * @date 2021/4/25
 */
@Getter
public enum OpenEnum {

    XX(1,"xx","xx贷"),
    PP(2,"pp","pp贷")

    ;

    private int code;

    private String apiName;

    private String loanName;

    OpenEnum(int code, String apiName, String loanName) {
        this.code = code;
        this.apiName = apiName;
        this.loanName = loanName;
    }

    public static int getCodeByApiName(String apiName) {
        for (OpenEnum value : values()) {
            if (value.apiName.equals(apiName)) {
                return value.code;
            }
        }
        return -1;
    }

    public static OpenEnum getFormByApiName(String apiName) {
        for (OpenEnum value : values()) {
            if (value.apiName.equals(apiName)) {
                return value;
            }
        }
        return null;

    }


}
